package com.example.bicycle.domain.entity;


import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
/**
 * (ElectricBike)表实体类
 *
 * @author makejava
 * @since 2023-08-02 21:29:32
 */
@SuppressWarnings("serial")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("electric_bikes")
public class ElectricBike  {
    @TableId
    @TableField("bike_id")
    private Integer bikeId;

    @TableField("battery_id")
    private Integer batteryId;
    
    @TableField("switch_state")
    private Integer switchState;
    
    @TableField("light_threshold")
    private Float lightThreshold;
    
    @TableField("latitude")
    private Float latitude;
    
    @TableField("longitude")
    private Float longitude;

    @TableField("is_using")
    private Integer isUsing;

    // 实现属性复制方法
    public void copyAttributesFrom(ElectricBike other) {
        if(other.getSwitchState() != null&&other.getSwitchState()!=this.switchState) {
            this.switchState = other.getSwitchState();
        }
        if(other.getLightThreshold() != null&&other.getLightThreshold()!=this.lightThreshold) {
            this.lightThreshold = other.getLightThreshold();
        }
        if(other.getLatitude() != null&&other.getLatitude()!=this.latitude) {
            this.latitude = other.getLatitude();
        }
        if(other.getLongitude() != null&&other.getLongitude()!=this.longitude) {
            this.longitude = other.getLongitude();
        }
    }
}

